package com.vinci.task.controller;


import com.alibaba.fastjson.JSONArray;
import com.vinci.task.entity.TbTaskRewards;
import com.vinci.task.service.TbTaskRewardsService;
import com.vinci.util.JsonObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * <p>
 * 奖励积分表 前端控制器
 * </p>
 *
 * @author 张先生
 * @since 2021-12-11
 */
@RestController
@RequestMapping("/task")
@Slf4j
public class TbTaskRewardsController {

    @Autowired
    private TbTaskRewardsService tbTaskRewardsService;

    /**
     * 审核任务是否完成
     * @param tbTaskRewards
     * @param session
     * @return
     */
    @RequestMapping("/ToExamine")
    public JsonObject ToExamine(TbTaskRewards tbTaskRewards, HttpSession session){


       JsonObject jsonObject = new JsonObject();
        if(tbTaskRewards == null){
            jsonObject.setCode("A0400");
            jsonObject.setMsg("用户请求参数错误");
        }else {
            tbTaskRewardsService.insertRewards(tbTaskRewards,session);
            jsonObject.setCode("1");
           jsonObject.setMsg("成功");

        }
        return jsonObject;
    }
}

